package com.yuntuzhilian.chapter4;

/**
 * @author MrWang-shuizhishuiheshui
 * @description 线程优先级
 */
public class Demo5 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName()+"****"+i);
        }
    }

    public static void main(String[] args) {
        Thread thread=new Thread(new Demo5());
        Thread thread1=new Thread(new Demo5());
        //设置线程优先级  1最低  10最高  默认为5
        thread.setPriority(10);
        thread1.setPriority(1);
        System.out.println("thread:"+thread.getPriority());
        System.out.println("thread1:"+thread1.getPriority());
        System.out.println("**********************************|");
        thread.start();
        thread1.start();
    }
}
